package com.huilian.iotbox.admin.service;

import com.github.pagehelper.PageInfo;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.dto.UserDto;
import com.huilian.iotbox.data.po.Permission;
import com.huilian.iotbox.data.po.User;
import com.huilian.iotbox.data.vo.UserInfo;
import com.huilian.iotbox.data.vo.UserVo;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Set;

/**
 * @author 少凡
 * @date 2020/2/23 10:38
 */
public interface UserService {

    /**
     * 根据登录用户名查找用户
     *
     * @param username
     * @param status
     * @return
     */
    User findUserByLoginUserName(String username, Integer status);

    /**
     * 获取登录用户权限
     *
     * @param userId
     * @return
     */
    List<Permission> findUserPermission(Object userId);

    /**
     * 根据token获取登录用户信息
     *
     * @param request
     * @return
     */
    UserInfo getLoginUserInfo(HttpServletRequest request);

    /**
     * 查询用户并且查询用户所属的权限 查询多个
     */
    List<UserVo> findStaffListByAgencyId(UserVo userVo);

    ServerResponse checkUserName(User user);

    ServerResponse checkIdCardNo(String idCardNo, String agencyId, UserInfo userInfo);

    int insert(User user);

    User findUserById(Integer id);

    int update(User newUserInfo);

    PageInfo<UserVo> findByNameAndMobile(UserDto userDto);

    void addUserAndAddRole(UserDto userDto);

    ServerResponse checkMobile(String mobile);

    List<User> getAllUserOfName(UserInfo userInfo, String agencyId);

    PageInfo findUserList(UserDto userDto);

    ServerResponse registerSmsCode(String mobile);

    ServerResponse register(UserDto userDto);

    ServerResponse updatePwd(UserDto userDto);

    ServerResponse updateUser(UserDto userDto);


//    void subtractBalance(User tempUser,int i);
//
//    void addBalance(User user, int i);

    /**
     * 统计新增运营商数量
     */
    Integer findNewOperatorsCount(Integer agencyId, String startTime, String endTime);


    /**
     * 根据Set集合统计没消费的运营商
     *
     * @param set
     * @return
     */
    Integer findSetUserNoTrade(Integer agencyId, Set<Integer> set);

    UserVo findOperatePasswordByOutTradeNoByUserId(String outTradeNo, Integer userId);

    UserVo getUserId(Integer userId);

    List<User> findAllUserByParentId(Integer userId);

    ServerResponse updateWelfareReturnCoinSum(UserDto userDto);

    ServerResponse updateLoginUser(User user);

    ServerResponse updateInfo(UserDto userDto);

    ServerResponse resetPwdById(UserDto userDto);

    ServerResponse getCode(UserDto userDto);

    ServerResponse forgetPassword(UserDto userDto);

    ServerResponse changeSignStatus(UserDto userDto);

    ServerResponse resetOperatePwdById(UserDto userDto);

    List<User> getAllUserSubAccountOfName(UserInfo userInfo,String userIdType);
}
